home *** CD-ROM | disk | FTP | other *** search
/ Apple Reference & Presen…on Library 1994 September / ARPLE-Sept-94-Supplement.iso / AppleSoft / System 7.5 Demos *Revised* / System Folder / Extensions / QuickDraw™ GX / QuickDraw™ GX.rsrc / psbt_-28347 < prev    next >
Encoding:
Text File  |  1994-08-19  |  9.3 KB  |  570 lines

  1. %Planguagelevel 2 lt {
  2. /ShapeBuildChar {
  3. pop 
  4. begin 
  5. 0 setlinewidth 
  6. Shape begin 
  7. AdvanceVector dup 0 get exch 1 get 
  8. shapeType /i ne { 
  9. x1 y1 Grid x2 y2 Grid setcachedevice    
  10. geomProc 
  11. FillDict fillKey get exec 
  12. } { 
  13. setcharwidth 
  14. geomProc 
  15. } ifelse
  16. end
  17. end
  18. } Bdef
  19. } {
  20. /PatternPaintProc {
  21. begin 
  22. IpatTransform concat 
  23. patShape begin 
  24. CurrColorSet 
  25. colorSet SetColorSet 
  26. ColorSpace null ne { 
  27. ColorSpace setcolorspace 
  28. } if
  29. shapeType /b eq { 
  30. CurrOrMode 0 eq { 
  31. 0 colorSet SetIndexedColor 
  32. newpath
  33. x1 y1 moveto x2 y1 lineto
  34. x2 y2 lineto x1 y2 lineto
  35. closepath
  36. fill
  37. } if
  38. ImageMaskColor colorSet SetIndexedColor 
  39. } if
  40. newpath 
  41. geomProc 
  42. FillDict fillKey get exec 
  43. SetColorSet 
  44. end
  45. end
  46. } Bdef
  47. } ifelse 
  48. languagelevel 2 lt { 
  49. /MakeShapeFont {
  50. 8 dict dup begin 
  51. 4 1 roll 
  52. [3 1 roll]
  53. /AdvanceVector Xdef 
  54. /Shape Xdef
  55. /FontType 3 def
  56. /FontMatrix [1 0 0 1 0 0] def 
  57. /FontBBox [ 
  58. Shape ShapeBBox
  59. ] def
  60. /Encoding StandardEncoding def 
  61. /BuildChar /ShapeBuildChar load def
  62. end
  63. } Bdef
  64. } if 
  65. /PortMapping matrix def
  66. /PortPatternMapping matrix def 
  67. /SaveCTMForPattern matrix def 
  68. /GridMatrix {
  69. dup 0 get 
  70. 1 index 3 get 
  71. 0.0 eq exch 0.0 eq and    
  72. 1 index 1 get 
  73. 2 index 2 get 
  74. 0.0 eq exch 0.0 eq and    
  75. or { 
  76. 0 1 3 { 
  77. dup 
  78. 2 index exch 
  79. get dup abs 1.0 gt {    
  80. round 
  81. } if
  82. 2 index 
  83. 3 1 roll put 
  84. } for
  85. pop 
  86. } if
  87. } bind def
  88. /SetupPatternCTM {
  89. SaveCTMForPattern currentmatrix pop
  90. PortMap    { 
  91. PortMapping PortPatternMapping
  92. copy dup GridMatrix 
  93. setmatrix 
  94. PortAllign not { 
  95. 0 0 SaveCTMForPattern transform    itransform 
  96. translate
  97. } if
  98. } { 
  99. PortAllign { 
  100. 0 0 PortMapping transform itransform
  101. translate
  102. } if
  103. } ifelse
  104. } Bdef
  105. languagelevel 2 lt {
  106. /MakePatternDict {
  107. 21 dict dup begin 
  108. 10 1 roll 
  109. /PortAllign Xdef
  110. /PortMap Xdef
  111. /py Xdef /px Xdef
  112. /vy Xdef /vx Xdef
  113. /uy Xdef /ux Xdef
  114. /patTransform [ 
  115. ux uy
  116. vx vy
  117. px py
  118. ] def
  119. dup /shapeType get /b eq {
  120. dup ShapeBBox 
  121. BoxWidths 
  122. vy ne vx 0 ne or 
  123. exch ux ne uy 0 ne or 
  124. or { 
  125. dup /shapeType /i put
  126. } if
  127. } if
  128. ux uy MakeShapeFont 
  129. /patternFont exch definefont    
  130. /patternFontDict Xdef 
  131. /IpatTransform 
  132. patTransform matrix
  133. invertmatrix
  134. def
  135. end
  136. } Bdef
  137. } {    
  138. /MakePatternDict {
  139. 10 dict dup begin 
  140. 10 1 roll 
  141. /PatternType 1 def 
  142. /PortAllign Xdef 
  143. /PortMap Xdef 
  144. [ 7 1 roll ] 
  145. /patTransform Xdef 
  146. /XStep 1 def 
  147. /YStep 1 def
  148. /TilingType CurrGridFit {2} {1} ifelse def 
  149. /PaintProc /PatternPaintProc load def 
  150. /IpatTransform 
  151. patTransform [0 0 0 0 0 0]
  152. invertmatrix
  153. def
  154. /patShape Xdef 
  155. /BBox [
  156. gsave
  157. ScratchMatrix currentmatrix 
  158. IpatTransform concat 
  159. patShape /shapeType get /g eq { 
  160. patShape /geomProc get exec 
  161. setmatrix 
  162. /flattenpath 0 AvoidLimit pathbbox 
  163. } { 
  164. patShape ShapeBBox 
  165. 4 2 roll 4 copy 4 2 roll BoxWidths RP 
  166. pop pop
  167. setmatrix 
  168. pathbbox 
  169. } ifelse
  170. grestore
  171. ] def
  172. /PaintType 
  173. patShape /shapeType get dup /i eq exch /b eq or { 
  174. } { 
  175. }ifelse 
  176. def
  177. end
  178. dup /patTransform get 
  179. makepattern 
  180. } Bdef
  181. } ifelse 
  182. languagelevel 2 lt {
  183. /patternString 100 string def 
  184. /PatternFill {
  185. CurrPat begin 
  186. gsave 
  187. SetupPatternCTM 
  188. patternFontDict /Shape get /shapeType get /b eq {
  189. CurrOrMode 0 eq { 
  190. 0 patternFontDict /Shape get /colorSet get SetIndexedColor 
  191. dup 
  192. gsave {fill} {eofill} ifelse grestore 
  193. } if
  194. ImageMaskColor patternFontDict /Shape get /colorSet get SetIndexedColor 
  195. } { 
  196. patternFontDict /Shape get /shapeType get /i eq {
  197. patternFontDict /Shape get dup /colorSet get dup 
  198. null ne { 
  199. SetColorSet 
  200. /BitsPerPixel get 2 exch exp 1 sub /MaxSampleInt exch store 
  201. InstallColorSetTransfers 
  202. } {
  203. pop 
  204. pop 
  205. } ifelse
  206. } if
  207. } ifelse
  208. {/clip 0 AvoidLimit}
  209. {/eoclip 0 AvoidLimit}
  210. ifelse 
  211. /flattenpath 0 AvoidLimit 
  212. /pathbbox    load stopped 
  213. {0 0 0 0} if 
  214. newpath 
  215. patternFontDict dup setfont 
  216. /FontBBox get 
  217. {} forall BoxWidths 
  218. 6 2 roll 
  219. 4 index add 
  220. exch 
  221. 5 index add 
  222. 4 2 roll 
  223. 4 index sub 
  224. exch 
  225. 5 index sub 
  226. exch 4 2 roll exch 
  227. /y2 Xdef
  228. /x2 Xdef
  229. /y1 Xdef
  230. /x1 Xdef
  231. x1 y1 IpatTransform transform pop 
  232. x1 y2 IpatTransform transform pop 
  233. Min 
  234. x2 y1 IpatTransform transform pop 
  235. x2 y2 IpatTransform transform pop 
  236. Min 
  237. Min floor /x1p Xdef 
  238. x1 y1 IpatTransform transform pop 
  239. x1 y2 IpatTransform transform pop 
  240. Max 
  241. x2 y1 IpatTransform transform pop 
  242. x2 y2 IpatTransform transform pop 
  243. Max 
  244. Max ceiling /x2p Xdef 
  245. x1 y1 IpatTransform transform exch pop 
  246. x2 y1 IpatTransform transform exch pop 
  247. Min 
  248. x1 y2 IpatTransform transform exch pop 
  249. x2 y2 IpatTransform transform exch pop 
  250. Min 
  251. Min floor /y1p Xdef 
  252. x1 y1 IpatTransform transform exch pop 
  253. x2 y1 IpatTransform transform exch pop 
  254. Max 
  255. x1 y2 IpatTransform transform exch pop 
  256. x2 y2 IpatTransform transform exch pop 
  257. Max 
  258. Max ceiling /y2p Xdef 
  259. /x1p x1p floor def
  260. /y1p y1p floor def
  261. /x2p x2p ceiling def
  262. /y2p y2p ceiling def
  263. pop pop 
  264. /lattWidth x2p x1p sub 1 add cvi def
  265. y1p 1 y2p {
  266. x1p exch patTransform transform moveto 
  267. 0 100 lattWidth { 
  268. lattWidth exch sub 
  269. dup 100 gt { 
  270. pop 100 
  271. } if 
  272. patternString 0 3 -1 roll getinterval 
  273. show 
  274. } for 
  275. } for
  276. grestore
  277. newpath
  278. end
  279. } Bdef
  280. } if 
  281. /PathLength {
  282. /@1 0 def 
  283. { /@3 Xstore /@2 Xstore } 
  284. { 2 copy 
  285. @3 sub dup mul 
  286. exch @2 sub dup mul 
  287. add sqrt 
  288. @1 add /@1 Xdef 
  289. /@3 Xstore /@2 Xstore    
  290. }
  291. {} 
  292. {} 
  293. /flattenpath 0 AvoidLimit    
  294. pathforall
  295. @1 
  296. } Bdef
  297. /MakeDashDict {
  298. 14 dict dup begin 
  299. 7 1 roll 
  300. /dashScale Xdef 
  301. /phase Xdef 
  302. /advance Xdef 
  303. /levelDash Xdef 
  304. /autoAdvance Xdef 
  305. /Shape Xdef 
  306. /FirstX null def /FirstY 0 def 
  307. /LastX 0 def /LastY 0 def
  308. /CurrCTM [0 0 0 0 0 0] def 
  309. /N 0 def 
  310. end
  311. } Bdef
  312. /StampDash {
  313. LastX FirstX NotEqual
  314. LastY FirstY NotEqual or { 
  315. CurrDash 
  316. currentlinewidth 
  317. null SetDash 
  318. CurrCTM currentmatrix 
  319. FirstX FirstY translate 
  320. levelDash not { 
  321. LastY FirstY sub 
  322. LastX FirstX sub
  323. ATanRot
  324. } if
  325. 1 currentlinewidth scale 
  326. 0 setlinewidth 
  327. 0 frameOffset translate 
  328. 1 1 dashScale div scale 
  329. newpath 0 0 moveto
  330. Shape begin 
  331. geomProc 
  332. setmatrix 
  333. fillKey QD2Fill 
  334. end
  335. setlinewidth 
  336. SetDash 
  337. } if
  338. } Bdef
  339. /DashLT {/LastY Xdef /LastX Xdef} Bdef
  340. /DashCT {/LastY Xdef /LastX Xdef 4 {pop} repeat } Bdef
  341. /DashCP {} Bdef
  342. /DashMT {
  343. FirstX null eq { 
  344. /FirstY Xdef 
  345. /FirstX Xdef
  346. } { 
  347. 2 copy 
  348. LastY ne exch 
  349. LastX ne or    { 
  350. StampDash 
  351. /FirstY Xdef 
  352. /FirstX Xdef
  353. } { 
  354. pop pop 
  355. } ifelse
  356. } ifelse
  357. } Bdef
  358. /DashStroke {
  359. FullGsave
  360. begin 
  361. CurrRightIsOut {neg} if 
  362. /frameOffset Xdef
  363. Shape /colorSet get SetColorSet 
  364. Shape /ColorSpace get dup null ne { 
  365. setcolorspace
  366. } {
  367. pop
  368. } ifelse
  369. autoAdvance {
  370. PathLength dup advance div floor /N Xdef 
  371. N div 
  372. } { 
  373. advance 
  374. } ifelse
  375. /@1 Xdef 
  376. Shape    ShapeBBox 
  377. BoxWidths pop 
  378. dup 0 eq { 
  379. pop 
  380. @1 2 div 
  381. } if
  382. .10 mul 
  383. dup @1 exch sub 
  384. [3 1 roll] 
  385. phase setdash 
  386. currentlinewidth 
  387. 0 setlinewidth 
  388. /strokepath 0 AvoidLimit 
  389. setlinewidth 
  390. [] 0 setdash 
  391. /FirstX null def 
  392. /DashMT load
  393. /DashLT load
  394. /DashCT load
  395. /DashCP load 
  396. pathforall 
  397. FirstX null ne { 
  398. StampDash 
  399. } if 
  400. end
  401. FullGrestore newpath
  402. } Bdef
  403. /FillDict 7 dict dup 3 -1 roll Xdef begin 
  404. /Fr {
  405. CurrDash null eq { 
  406. CurrFrame dup 0 eq { 
  407. stroke 
  408. pop
  409. } { 
  410. FillDict exch 
  411. -1 eq {/Of get} {/If get} ifelse
  412. exec
  413. } ifelse
  414. } { 
  415. CurrFrame CurrDash DashStroke    
  416. } ifelse
  417. } Bdef
  418. /If
  419. {gsave clip currentlinewidth 2 mul setlinewidth stroke grestore newpath} Bdef
  420. /Of
  421. {gsave FullPath /eoclip 0 AvoidLimit currentlinewidth 2 mul setlinewidth stroke grestore newpath} Bdef
  422. /Eo    /eofill load def
  423. /In {FullPath eofill} Bdef
  424. /W    /fill load def
  425. /No {} Bdef 
  426. end 
  427. languagelevel 1 eq {
  428. /PatternFillDict 6 dict dup 3 -1 roll Xdef begin 
  429. /Fr {
  430. CurrDash null eq { 
  431. CurrFrame dup 0 eq { 
  432. /strokepath 0 AvoidLimit true PatternFill 
  433. pop
  434. } { 
  435. PatternFillDict exch 
  436. -1 eq {/Of get} {/If get} ifelse
  437. exec
  438. } ifelse
  439. } { 
  440. CurrFrame CurrDash DashStroke    
  441. } ifelse
  442. } Bdef
  443. /W {true PatternFill} Bdef
  444. /Eo {false PatternFill} Bdef
  445. /In {TightFullPath false PatternFill} Bdef
  446. /If
  447. {gsave clip currentlinewidth 2 mul setlinewidth strokepath
  448. true exch PatternFill grestore newpath} Bdef
  449. /Of
  450. {gsave TightFullPath eoclip currentlinewidth 2 mul setlinewidth strokepath
  451. true exch PatternFill grestore newpath} Bdef
  452. end
  453. } if 
  454. languagelevel 1 eq {
  455. /QD2Fill {
  456. CurrPat null eq { 
  457. FillDict 
  458. } { 
  459. PatternFillDict 
  460. } ifelse
  461. exch get exec 
  462. } Bdef
  463. } { 
  464. /OldColorAndSpace [] def 
  465. /OldMatrix matrix def 
  466. /InstallPatternColorSpace {
  467. CurrPat null ne { 
  468. CurrPat begin
  469. PortMap PortAllign or {
  470. OldMatrix currentmatrix pop 
  471. SetupPatternCTM
  472. SynchPatMatrix
  473. } if
  474. /OldColorAndSpace [
  475. currentcolor currentcolorspace    
  476. ] store
  477. PaintType 2 eq {            
  478. currentcolor 
  479. dup type /dicttype eq {pop} if 
  480. } if
  481. end
  482. CurrPat setpattern 
  483. } if
  484. } Bdef
  485. /RestoreOldColorAndSpace {
  486. CurrPat null ne {
  487. CurrPat /PortAllign get CurrPat /PortMap get or {
  488. OldMatrix setmatrix
  489. } if
  490. OldColorAndSpace aload pop 
  491. setcolorspace setcolor 
  492. } if
  493. } Bdef
  494. /QD2Fill {
  495. InstallPatternColorSpace
  496. FillDict 
  497. exch get exec 
  498. RestoreOldColorAndSpace
  499. } Bdef
  500. } ifelse 
  501. /GlyphPaint {
  502. FullGsave 
  503. exch 
  504. HasBold { 
  505. CurrBold 
  506. AugGstate /FontMapping get 
  507. dtransform 
  508. SetBold 
  509. } if
  510. aChar 0 3 -1 roll put 
  511. dup 
  512. currentpoint newpath moveto 
  513. HasBold { 
  514. currentpoint 3 -1 roll 
  515. aChar true GXCharPath 
  516. CurrCTM currentmatrix exch 
  517. CurrBold scale 
  518. currentlinewidth 
  519. exch 
  520. 1 setlinewidth 
  521. dup /W eq 
  522. CurrPat null eq    and { 
  523. stroke 
  524. 3 -1 roll setmatrix 
  525. } { 
  526. strokepath 
  527. 3 -1 roll setmatrix 
  528. dup QD2Fill 
  529. } ifelse
  530. exch setlinewidth 
  531. 3 1 roll 
  532. moveto 
  533. } if
  534. aChar true GXCharPath
  535. currentpoint 
  536. 3 -1 roll 
  537. QD2Fill
  538. moveto 
  539. } forall
  540. pop 
  541. currentpoint 
  542. FullGrestore 
  543. moveto
  544. } Bdef
  545. /ShowDict 7 dict dup 3 -1 roll Xdef begin 
  546. languagelevel 1 eq {
  547. /W {CurrPat null eq HasBold not and {show} {/W GlyphPaint} ifelse} Bdef
  548. } {
  549. /W {
  550. HasBold not {
  551. InstallPatternColorSpace show RestoreOldColorAndSpace
  552. } {
  553. /W GlyphPaint
  554. } ifelse
  555. } Bdef
  556. } ifelse 
  557. /In {true GXCharPath /In QD2Fill} Bdef
  558. /Fr {/Fr GlyphPaint} Bdef
  559. /If {/If GlyphPaint} Bdef
  560. /Of {/Of GlyphPaint} Bdef
  561. /Eo    /W load def 
  562. /No {pop} Bdef
  563. end
  564. /QD2Show {
  565. ShowDict exch get exec
  566. } Bdef
  567.